//
//  CommonModel.m
//  GoldOperationClient
//
//  Created by yaxue wang on 16/8/1.
//  Copyright © 2016年 展鸿科技. All rights reserved.
//

#import "CommonModel.h"

#import <objc/runtime.h>
@implementation CommonModel
+ (NSDictionary *)MakeDictionaryFromModelClassWithPrex:(NSString *)prex{
    unsigned int outCount, i;
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    objc_property_t *properties = class_copyPropertyList([self class], &outCount);
    for (i=0; i<outCount; i++) {
        objc_property_t property = properties[i];
        NSString * key = [[NSString alloc]initWithCString:property_getName(property)  encoding:NSUTF8StringEncoding];
        [dic setValue:key forKey:[key stringByReplacingOccurrencesOfString:prex withString:@""]];
    }
    free(properties);
    return dic;
}
@end
